<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="utf-8" />
		<base href="../../../" />
		<script src="page.js"></script>
		<link type="text/css" rel="stylesheet" href="page.css" />
	</head>
	<body>
		[page:Loader] &rarr;

		<h1>[name]</h1>

		<p class="desc">用于加载`.tga`资源的加载器。<br />
		[link:https://en.wikipedia.org/wiki/Truevision_TGA TGA]是光栅图形，图形文件格式。
		</p>

		<h2>导入</h2>

		<p>
			[name]是附加项，必须显示的引用。请参考[link:#manual/introduction/Installation Installation / Addons]。
		</p>

		<code>
			import { TGALoader } from 'three/addons/loaders/TGALoader.js';
		</code>

		<h2>代码示例</h2>

		<code>
		// instantiate a loader
		const loader = new TGALoader();

		// load a resource
		const texture = loader.load(
			// resource URL
			'textures/crate_grey8.tga'
			// called when loading is completed
			function ( texture ) {

				console.log( 'Texture is loaded' );

			},
			// called when the loading is in progresses
			function ( xhr ) {

				console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );

			},
			// called when the loading fails
			function ( error ) {

				console.log( 'An error happened' );

			}
		);

		const material = new THREE.MeshPhongMaterial( {
			color: 0xffffff,
			map: texture
		} );
		</code>

		<h2>示例</h2>
		<p>
			[example:webgl_loader_texture_tga]
		</p>

		<h2>构造函数</h2>

		<h3>[name]( [param:LoadingManager manager] )</h3>
		<p>
		[page:LoadingManager manager] — 加载器使用的[page:LoadingManager loadingManager]。默认值为[page:LoadingManager THREE.DefaultLoadingManager]。
		</p>
		<p>
		创建新的[name].
		</p>

		<h2>属性</h2>
		<p>查看公共属性请参考基类[page:Loader]。</p>

		<h2>方法</h2>
		<p>查看公共方法请参考基类[page:Loader]。</p>

		<h3>[method:DataTexture load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
		<p>
		[page:String url] — 一个`.tga`文件的路径或者网络地址。<br />
		[page:Function onLoad] — (可选的)加载成功之后调用的函数。该函数以[page:DataTexture]为参数。<br />
		[page:Function onProgress] — (可选的)正在加载时调用的函数。参数为XMLHttpRequest实例，包含[page:Integer total]和[page:Integer loaded]。
		如果服务没有设置Content-Length头，.[page:Integer total]的值为0。<br />
		[page:Function onError] — (可选的)加载出现错误时调用的函数。该函将错误信息作为参数。<br />
		</p>
		<p>
			开始加载[page:DataTexture texture]并传递给onLoad。即时引用会将[page:DataTexture texture]直接返回(不一定加载完成)。
		</p>

		<h2>源代码</h2>

		<p>
			[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/TGALoader.js examples/jsm/loaders/TGALoader.js]
		</p>
	</body>
</html>
